<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

	<head>
		<base href="<%=basePath%>">
		<title>试题管理页面</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" href="css/font-awesome/css/font-awesome.css" />
		<link rel="stylesheet" href="css/common.css" />
		<link rel="stylesheet" href="css/contenRight.css" />
		<link rel="stylesheet" href="css/responsive.css" />
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/index.js"></script>
		<script type="text/javascript" src="js/app.js"></script>
		<link rel="stylesheet" href="css/pulg/jquery-ui/jquery-ui.min.css" />
		<script type="text/javascript" src="css/pulg/jquery-ui/jquery-ui.min.js"></script>
		<link rel="stylesheet" href="css/papers.css" />
		<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
		<link rel="stylesheet" href="js/My97DatePicker/skin/WdatePicker.css" />
	</head>
	<script type="text/javascript">
		function submitFrom() {
			var examName = document.getElementById("examName_edit").value;
			var examDate = document.getElementById("examDate_edit").value;
			var examLong = document.getElementById("examLong_edit").value;
			var examScore = document.getElementById("passingScore_edit").value;
			if(examName == "" || examDate=="" || examLong =="" || examScore ==""){
				alert("重要信息不能为空！");
			}else{
				$("#submitForm").attr("action", "addExam");
				$("#submitForm").submit();
			}	
		}

		$(function() {
			$("#questionRadioGloup").buttonset();
		});
	</script>

	<body style="overflow:-Scroll;overflow-x:hidden;overflow-y: hidden;">
		<div class="list-page">
			<div class="list-page-content">
				<div class="taskTabs">
					<ul class="taskOptions">
						<li>
							<a class="btnlist tabs selected" href="#overtime0" id="taskList">
								<i class="icon-user"></i> 试卷信息
							</a>
						</li>
						<li>
							<a class="btnAdd permissions_add tabs" href="#overtime1" id="taskAdd"><i class="icon-plus"></i>新的考试添加</a>
						</li>
					</ul>
					<div class="clear"></div>
					<div id="overtime0" class="task" data-pattern="priority-cloumns" style="display: block;">
						<table class="list-page-content-table datalist">
							<thead>
								<tr>
									<th>试卷编号</th>
									<th>试卷名称</th>
									<th>考试时间</th>
									<th>试卷状态</th>
									<th>出卷人</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<s:iterator value="#request.exams" var="exam">
									<tr align="center">
										<td>${exam.exam_id}</td>
										<td>${exam.exam_name}</td>
										<td>${exam.exam_begin }<%-- <s:date name="exam_begin" format="yyyy-MM-dd HH:mm:ss" /> --%>
										</td>
										<td>
											<s:if test="exam_stage == 0">
												<font color="red">未启用</font>
											</s:if>
											<s:elseif test="exam_stage == 1">
												<font color="grean">进行中</font>
											</s:elseif>
											<s:else>
												<font color="blue">已完成</font>
											</s:else>
										</td>
										<td>${exam.exam_author}</td>
										<td>
											<a class="editIcon permissions_update" href="examUpdateShow?exam_id=${exam.exam_id}"><i class="icon-edit"></i></a>
											<a class="deleteIcon permissions_delete" href="examDelete?exam_id=${exam.exam_id}&currentPage=${page.currentPage }"><i class="icon-trash"></i></a>
										</td>
									</tr>
								</s:iterator>
							</tbody>
						</table>
						<div class="list-page-content-table-paginate">
							<div class="p_pageBox pages">
								<s:if test="#request.page.hasPrePage">
									<a class="p_prev" href="selectExam?currentPage=${page.currentPage - 1} ">上一页</a>
								</s:if>
								<s:else>
									<a class="p_prev">上一页</a>
								</s:else>
								<c:forEach varStatus="stat" begin="1" end="${page.totalPage}">
									<s:if test="subjectTitle == null">
										<a href="selectExam?currentPage=${stat.index}">${stat.index}</a>
									</s:if>
									<s:else>
										<a href="selectExam?currentPage=${stat.index}">${stat.index}</a>
									</s:else>
								</c:forEach>
								<s:if test="#request.page.hasNextPage">
									<a class="p_next" href="selectExam?currentPage=${page.currentPage + 1}">下一页</a>
								</s:if>
								<s:else>
									<a class="p_next">下一页</a>
								</s:else>
							</div>
						</div>
						<div class="clear"></div>
					</div>
					<div id="overtime1" class="task" data-pattern="priority-cloumns" style="display: none;">
						<div class="editPage">
							<div class="editPages">
								<div class="editPageTitle">
									<p class="titleLeft">
										<i class="icon-list-alt"></i>
										<span>新的试卷</span>
									</p>
									<p class="titleRight">
										<i class="toggleBox icon-chevron-up"></i>
									</p>
									<div class="clear"></div>
								</div>

								<div class="editPageInfo" style="display: block;">
									<form class="form-horizontal editForm" id="submitForm">
										<div class="control-group">
											<label class="control-label">
											<span class="necessary">*</span>
											试卷名称：
											</label>
											<div class="controls">
												<input class="m-wrap editP" id="examName_edit" name="examName" type="text" placeholder="请输入试卷名称！" />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">
												<span class="necessary">*</span>
												开考时间：
												</label>
											<div class="controls">
												<input class="m-wrap editP" id="examDate_edit" name="examBegin" type="text" value placeholder="请输入开考时间" onfocus="WdatePicker({isShowClear:false,readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})" alt="date" readonly/>
											</div>

										</div>
										<div class="control-group">
											<label class="control-label">
												<span class="necessary">*</span>
												考试时长;
											</label>
											<div class="controls">
												<input class="m-wrap editP" id="examLong_edit" name="examTime" type="text" value placeholder="请输入考试时长/分钟" />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">
												<span class="necessary">*</span>
												及格分数：
											</label>
											<div class="controls">
												<input class="m-wrap editP" id="passingScore_edit" name="examScore" type="text" value placeholder="请输入及格分数" />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">
											<span class="necessary">*</span>
											随机开始题目数：
											</label>
											<div class="controls">
												<select name="examSubjectNum" class="editP">
													<option value="15">15</option>
													<option value="20">20</option>
													<option value="25">25</option>
												</select>
											</div>
										</div>
										<div class="control-group">
											<label class="control-label"><span class="necessary">*</span>状态：</label>
											<div class="controls" id="questionRadioGloup">
												<label for="answerRadio1_edit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only " role="button">
													<span class="ui-button-text">未启动</span>
												</label>
												<input type="radio" id="answerRadio1_edit" name="examStage" value="0" class="ui-helper-hidden-accessible" checked="checked" />
												<label for="answerRadio2_edit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only " role="button">
													<span class="ui-button-text">进行中</span>
												</label>
												<input type="radio" id="answerRadio2_edit" name="examStage" value="1" class="ui-helper-hidden-accessible" />
												<label for="answerRadio3_edit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only " role="button">
													<span class="ui-button-text">已完成</span>
												</label>
												<input type="radio" id="answerRadio3_edit" name="examStage" value="2" class="ui-helper-hidden-accessible" />
											</div>

										</div>
									<!--	<div class="control-group">
											<div class="controls">
												<a class="btn permissions_add" id="" title="添加随机试题" onclick="showAddQuestionRandom()">
													<i class="icon-plus"></i>添加随机试题
												</a>
												<a class="btn permissions_add" id="" title="添加试题" onclick="">
													<i class="icon-plus"></i>添加试题
												</a>
											</div>

										</div>-->

									<!--	<fieldset class="listQuest_field" id="listQuest_field_0">
											<legend>单选题</legend>
											<ul id="listQuest_0"></ul>
										</fieldset>-->
									</form>
								</div>
							</div>
							<div class="submitBtn">
								<a class="btn blue btnEdit editP" onclick="submitFrom()">
									<i class="icon-ok"></i>提交
								</a>
								<a class="btn btnReturn" href="subjectQuery">
									<i class="icon-remove"></i>取消
								</a>
							</div>

						</div>
					</div>

				</div>

			</div>
		</div>
<!--	<div id="questionRandomDialog" class="ui-dialog-content ui-widget-content" style="width: 435px;min-height: 38px;max-height: none;height: 326px;">
			<fieldset class="questionRandom" id>
				<legend>单选题</legend>
				<label><span>个数：</span>
					<input type="text" class="m-wrap small" id name="randNum" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" value="20"/>
				</label>
				<label>
					<span>分数：</span>
					<input type="text" class="m-wrap small" id="randScore_0" name="randScore" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpase="this.value=this.value=replace(/\D/g,'')" value="5"/>
				</label>
			</fieldset>
		</div>-->
	</body>

</html>